package com.meta.platform.contract.core.repository.impl;

import com.meta.platform.contract.core.mapper.ContractMapper;
import com.meta.platform.contract.domain.tunnel.db.ContractRepository;
import com.meta.platform.contract.intf.entity.Contract;
import com.meta.platform.contract.intf.ro.ContractRo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 合同表
 *
 * @Title: ContractRepositoryImpl
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2020-12-08 15:53:37
 * @Version: v2.0
 */
@Service
public class ContractRepositoryImpl implements ContractRepository {

    @Autowired
    private ContractMapper contractMapper;

    /**
     * insert contract info
     *
     * @param contract:
     * @return void
     * @method insertContract
     * @author M.simple
     * @date 2020-12-08 15:53:37
     */
    @Override
    public void insertContract(Contract contract) {
        contractMapper.insertContract(contract);
    }

    /**
     * batch insert contract info
     *
     * @param contracts:
     * @return void
     * @method insertContract
     * @author M.simple
     * @date 2020-12-08 15:53:37
     */
    @Override
    public void batchInsertContract(List<Contract> contracts) {
        contractMapper.batchInsertContract(contracts);
    }

    /**
     * update contract info
     *
     * @param contract:
     * @return int
     * @method updateContract
     * @author M.simple
     * @date 2020-12-08 15:53:37
     */
    @Override
    public int updateContract(Contract contract) {
        return contractMapper.updateContract(contract);
    }

    /**
     * update contract info by Pk
     *
     * @param contract:
     * @return int
     * @method updateContractByPk
     * @author M.simple
     * @date 2020-12-08 15:53:37
     */
    @Override
    public int updateContractByPk(Contract contract) {
        return contractMapper.updateContractByPk(contract);
    }

    /**
     * list contract info
     *
     * @param contract:
     * @return List<Contract>
     * @method listContract
     * @author M.simple
     * @date 2020-12-08 15:53:37
     */
    @Override
    public List<Contract> listContract(ContractRo contract) {
        return contractMapper.listContract(contract);
    }

    @Override
    public List<Contract> checkContractName(ContractRo contractRo) {
        return contractMapper.checkContractName(contractRo);
    }
}
